<?php
define('PAGE_LOAD_START',round(microtime(), 4));
$system_content = "";
$system_header = "";
function windowsToUnixPathC ($str) {
	$str = preg_replace('/[a-zA-Z]:\\\/', '\\', $str);
	$str = str_replace("\\",'/', $str);
	return $str;
}
$base_pages = array("index.php", "admin.php", "test.php", "config.php");
$base_url[0] = windowsToUnixPathC(realpath(getcwd().'/')).'/';
foreach($base_pages as $key => $value) {
	$base_url = explode($value, $base_url[0]);
}
$visual[0] = $_SERVER["REQUEST_URI"];
foreach($base_pages as $key => $value) {
	$visual = explode($value, $visual[0]);
}
if(SIMPLE_CLEAN_URLS) {
	$visual[0] = rtrim($visual[0],'/');
	$ex = explode('/', $visual[0]);
	$count = count($ex);
	for($i = 0;$i < (4 - 1);$i++) {
		$final .= $ex[$i].'/';
	}
	$visual[0] = $final;
}
else {	
	$visual = preg_split("/[0-9]+\//", $visual[0]);
}
$visual = explode("search/", $visual[0]);
$base_url = explode("includes/admin/tinybrowser/", $base_url[0]);
if(substr_count($visual[0], '?') > 0) {
	$visual = explode('?debug=true', $visual[0]);
}
$visual[0] = rtrim($visual[0], '/').'/';
$base_url[0] = rtrim($base_url[0], '/').'/';
define('BASE_URL', $base_url[0]);
define('SERVER_ABS_PATH', $base_url[0]);
define('SERVER_ABS_URL', $base_url[0]);
define('THEME_URL', $visual[0]);
define('VISUAL_PATH', $visual[0]);
define('VISUAL_URL', $visual[0]);
if(!defined('S_BASE_URL')) {
	define('S_BASE_URL', $visual[0]);
}
?>